home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / driverkit / IODiskPartition.h < prev    next >
Text File  |  1993-08-06  |  3KB  |  102 lines

  1. /*     Copyright (c) 1991 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * IODiskPartition.h - interface for NeXT-style LogicalDisk.
  4.  *
  5.  * HISTORY
  6.  * 01-May-91    Doug Mitchell at NeXT
  7.  *      Created.
  8.  *
  9.  *
  10.  * This IOLogicalDisk class handles all NeXT/Unix File system specific 
  11.  * operations pertaining to a physical disk.
  12.  *
  13.  * For a given physical disk, there are two types of DiskObjects:
  14.  *
  15.  * -- The physical disk. This is a subclass of DiskObject like SCSIDisk.
  16.  *    I/O to the Unix "live partition" is performed directly on the
  17.  *    physical disk, as are device-specific ioctl's. 
  18.  *
  19.  * -- IODiskPartition partition instances. There is one of these per valid 
  20.  *    partition in physicalDisk's label. There is always at least one 
  21.  *    IODiskPartition partition, corresponding to partition 0, even if 
  22.  *    there is no valid label or if the label has no partition 0. Common 
  23.  *    ioctl-type operations like eject are performed on IODiskPartition
  24.  *    partitions; this allows common error checking before (possibly) 
  25.  *    passing the method on to device-specific code. All normal Unix 
  26.  *    reads and writes (other than thru the live partition) are performed 
  27.  *    on an IODiskPartition partition.
  28.  *
  29.  *    Certain operations result in freeing all IODiskPartition partitions 
  30.  *    other than partition 0. These operations are: eject, writeLabel, and
  31.  *    setFormatted. Each of these force us to discard our current partition
  32.  *    state since they basically obliterate the current label. All of these
  33.  *    have the following restrictions:
  34.  *
  35.  *    -- they must be performed on partition 0, since all other 
  36.  *       IODiskPartition partitions wil be freed.
  37.  *    -- No block devices can be open. (Open block devices represent open
  38.  *         file systems, for which these operations are catastrophic).
  39.  *    -- No other IODiskPartition partitions may be open. 
  40.  */
  41.  
  42. #import <driverkit/IOLogicalDisk.h>
  43. #import <bsd/dev/disk_label.h>
  44. #ifdef    KERNEL
  45. #import <driverkit/kernelDiskMethods.h>
  46. #import <bsd/dev/ldd.h>
  47. #endif    KERNEL
  48.  
  49. /*
  50.  * Public NXDisk methods.
  51.  */
  52. @protocol IODiskPartitionExported
  53.  
  54. /*
  55.  * Read disk label.
  56.  */
  57. - (IOReturn) readLabel        : (out disk_label_t *)label_p;
  58.  
  59. /*
  60.  * Write disk label.
  61.  */
  62. - (IOReturn) writeLabel        : (in disk_label_t *)label_p;
  63.  
  64. /*
  65.  * Get/set "device open" flags.
  66.  */
  67. - (BOOL)isBlockDeviceOpen;
  68. - (void)setBlockDeviceOpen    : (BOOL)openFlag;
  69. - (BOOL)isRawDeviceOpen;
  70. - (void)setRawDeviceOpen    : (BOOL)openFlag;
  71.  
  72. @end
  73.  
  74. @interface IODiskPartition:IOLogicalDisk <IODiskPartitionExported>
  75.  
  76. {
  77. @private
  78.     int         _partition;        // like 3 LSB's of the old
  79.                         // UNIX minor number
  80.  
  81.     BOOL        _labelValid;        // label is valid
  82.     BOOL        _blockDeviceOpen;    // block device is open
  83.     BOOL        _rawDeviceOpen;        // raw device is open
  84.     int        _IODiskPartition_reserved[4];
  85. }
  86.  
  87. + (IODeviceStyle)deviceStyle;
  88. + (Protocol **)requiredProtocols;
  89.  
  90. /*
  91.  * Examine a physical disk; create necessary instances of NXDisk.
  92.  * Returns non-nil if any instances were created. 
  93.  */
  94. + (BOOL)probe : (id)deviceDescription;
  95.  
  96. /*
  97.  * Free all attached logicalDisks.
  98.  */
  99. - free;
  100.  
  101. @end
  102.